#include<iostream>

using namespace std;

int main()
{
	int memory[100] = { 0 };
	for (int i = 0; i < 100; i++)
	{
		memory[i] = -1;
	}
	int M, N, temp, length = 0, sum = 0;
	cin >> M >> N;
	for (int i = 0; i < N; i++)
	{
		cin >> temp;
		bool flag = false;
		for (int j = 0; j < M; j++)
		{
			if (memory[j] == temp)
			{
				flag = true;
				break;
			}
		}
		if (flag == false)
		{
			memory[length] = temp;
			length + 1 > M - 1 ? length = 0 : length++;
			sum++;
		}
	}
	cout << sum;
	return 0;
}